package com.fqgj.sentry.policy.enums;

/**
 * Created by zwh @yuntu-inc.com
 *
 * @description
 * @create 2017/7/31 0031 上午 9:39
 */
public enum ColumnTypeEnum {

    all_field(-1, "全部字段"),
    function(-2, "全部函数"),
    field_function(-3, "全部字段+函数"),
    sys_field_function(-4, "系统字段+函数"),
    all_no_grade(-5, "全部字段(除了评分)"),

    sys_field(1, "系统字段"),
    custom_field(2, "自定义字段"),
    grade_field(3, "评分卡字段"),
    sys_function(4, "系统函数"),
    custom_function(5, "自定义函数");




    private Integer type;
    private String desc;

    ColumnTypeEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static String getDesc(Integer type) {
        for (ColumnTypeEnum columnStatusEnum : ColumnTypeEnum.values()) {
            if (columnStatusEnum.getType().equals(type)) {
                return columnStatusEnum.getDesc();
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static ColumnTypeEnum getEnumByType(int type) {
        ColumnTypeEnum columnStatusEnum = null;
        for (ColumnTypeEnum e : ColumnTypeEnum.values()) {
            if (e.getType() == type) {
                return e;
            }
        }
        return columnStatusEnum;
    }
}
